home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
011
/
fc20hpgm.arc
/
RAWMODE.MAC
< prev
next >
Wrap
Text File
|
1986-08-29
|
3KB
|
107 lines
;
; This is file: RAWMODE.MAC
;
; Written by Mark Hersey
; Hersey Micro Consulting, Inc.
;
; This program is public domain. No copyrights reserved.
;
; The purpose of these subroutines is to allow your program
; to use raw console output, which is faster than the
; normal (cooked or ASCII) mode. When the console is in cooked
; mode, MS-DOS checks for console input (specifically looking
; for Ctrl-C == Ctrl-Break) with every character
; that is written to the screen. In raw mode, it will not.
;
; You may need to change the procedure names to match
; the requirements of your compiler.
; You may need to change the segment and group names to match
; those used by your compiler.
;
.xlist
include compiler.mlb
if1
include macros.mlb
endif
.list
xinit ;Initialize structured macros.
dgroup group _data
_data segment byte public 'data'
assume nothing
saved_mode db ?
assume nothing
_data ends
if bigcode
rawmode_text segment byte public 'code'
assume cs:rawmode_text
else ;not bigcode
_text segment byte public 'code'
assume cs:_text
endif ;bigcode
assume ds:dgroup
;
; _raw_mode - Save old mode and put console device into raw mode.
;
; Inputs:
; None
; Outputs:
; [saved_mode] has old mode in it.
; Console is in raw mode.
; Comments:
; Call once at the start of your program.
;
procdcl _raw_mode
mov ah,044h ;I/O-Control call for devices.
mov al,000h ;Get device information.
mov bx,001h ;File handle for CON: output.
int 021h ;Make MS-DOS call.
mov [saved_mode],dl ;Save old mode.
mov ah,044h ;I/O-Control call for devices.
mov al,001h ;Set device information.
mov bx,001h ;File handle for CON: output.
xor dh,dh ;Must be zero.
or dl,020h ;Set raw mode bit, leave others same.
int 021h ;Make MS-DOS call.
ret
_raw_mode endp
;
; _old_mode - Save old mode and put console device into raw mode.
;
; Inputs:
; [saved_mode] has old mode in it.
; Outputs:
; Console is set to [saved_mode].
; Comments:
; Call once at the end of your program.
;
procdcl _old_mode
mov ah,044h ;I/O-Control call for devices.
mov al,001h ;Set device information.
mov bx,001h ;File handle for CON: output.
xor dh,dh ;Must be zero.
mov dl,[saved_mode] ;Get old mode.
int 021h ;Make MS-DOS call.
ret
_old_mode endp
assume nothing
if bigcode
rawmode_text ends
else ;not bigcode
_text ends
endif ;bigcode
end